class Events
  attr_accessor :github

  def initialize(github)
    @github = github
  end

  def listEvents()
    @github.get('events')
  end

  def listRepoEvents(repo, user=nil)
    username = user == nil ? @github.username : user
    @github.get('repos/%s/%s/events' % [username, repo])
  end

  def listRepoNetworkPublicEvents(repo, user=nil)
    username = user == nil ? @github.username : user
    @github.get('network/%s/%s/events' % [username, repo])
  end

  def listOrgPublicEvents(org)
    @github.get('orgs/%s/events' % org)
  end

  def listRepoIssueEvents(repo, user=nil)
    username = user == nil ? @github.username : user
    @github.get('repos/%s/%s/issues/events' % [username, repo])
  end

  def listReceivedEvents(user=nil)
    username = user == nil ? @github.username : user
    @github.get('users/%s/received_events' % username)
  end

  def listReceivedPublicEvents(user=nil)
    username = user == nil ? @github.username : user
    @github.get('users/%s/received_events/public' % username)
  end

  def listOrgEvents(org)
    username = @github.username
    @github.get('users/%s/events/orgs/%s' % [username, org])
  end
end